/**
 * 
 */
package com.starhub.sample.services.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.starhub.sample.dao.BannerDAO;
import com.starhub.sample.entities.Banner;
import com.starhub.sample.services.BannerService;

/**
 * @author Hoan.NguyenTrong Jan 7, 2015
 * 
 */
@Service(value = "bannerService")
@Transactional
public class BannerServiceImpl implements BannerService {

    @Autowired
    private BannerDAO bannerDAO;

    public List<Banner> getAllBanners() {

	List<Banner> banneList = bannerDAO.getAll();
	return banneList == null ? new ArrayList<Banner>() : banneList;
    }

    public Banner saveOrUpdate(Banner banner) {
	return bannerDAO.saveOrUpdate(banner);
    }
}
